package jf.collections;

/**
 * @author alex
 * @date 09.05.2009
 */
public class Tuple4<T1, T2, T3, T4> {
	public final T1 _1;
	public final T2 _2;
	public final T3 _3;
	public final T4 _4;

	public Tuple4(T1 a1, T2 a2, T3 a3, T4 a4) {
		this._1 = a1;
		this._2 = a2;
		this._3 = a3;
		this._4 = a4;
	}

	public T1 _1() {
		return _1;
	}

	public T2 _2() {
		return _2;
	}

	public T3 _3() {
		return _3;
	}

	public T4 _4() {
		return _4;
	}

	@Override
	public boolean equals(Object o) {
		if (this == o) return true;
		if (o == null || getClass() != o.getClass()) return false;

		Tuple4 tuple4 = (Tuple4) o;

		if (_1 != null ? !_1.equals(tuple4._1) : tuple4._1 != null) return false;
		if (_2 != null ? !_2.equals(tuple4._2) : tuple4._2 != null) return false;
		if (_3 != null ? !_3.equals(tuple4._3) : tuple4._3 != null) return false;
		if (_4 != null ? !_4.equals(tuple4._4) : tuple4._4 != null) return false;

		return true;
	}

	@Override
	public int hashCode() {
		int result = _1 != null ? _1.hashCode() : 0;
		result = 31 * result + (_2 != null ? _2.hashCode() : 0);
		result = 31 * result + (_3 != null ? _3.hashCode() : 0);
		result = 31 * result + (_4 != null ? _4.hashCode() : 0);
		return result;
	}

	@Override
	public String toString() {
		return "Tuple{" +
				"_1=" + _1 +
				", _2=" + _2 +
				", _3=" + _3 +
				", _4=" + _4 +
				'}';
	}
}
